package br.sales.persistence;

import br.sales.view.util.ViewUtil;

import com.db4o.ObjectContainer;

public class PersistenceFactory {

	public static IPersistence createDB4ODAO(ObjectContainer container){
		return new DB4ODAO(container);
	}
	
	public static IPersistence createDB4ODAO(){
		return new DB4ODAO(DB4OAppSingleton.getSession());
	}
	
	public static IPersistence createSessionDB4ODAO(){
		ObjectContainer obj = ViewUtil.getRequestObjectContainer();
		return  obj != null ? new DB4ODAO(obj) : createDB4ODAO() ;
	}
}
